home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 22 / Cream of the Crop 22.iso / program / pce32dll.zip / PCEDLL / VBASIC / VBDEMO~1.FRM < prev   
Text File  |  1996-10-22  |  3KB  |  96 lines

  1. VERSION 4.00
  2. Begin VB.Form Form1 
  3.    Caption         =   "PCE32.DLL Demo"
  4.    ClientHeight    =   4140
  5.    ClientLeft      =   1140
  6.    ClientTop       =   1515
  7.    ClientWidth     =   6870
  8.    Height          =   4545
  9.    Left            =   1080
  10.    LinkTopic       =   "Form1"
  11.    ScaleHeight     =   4140
  12.    ScaleWidth      =   6870
  13.    Top             =   1170
  14.    Width           =   6990
  15.    Begin VB.CommandButton Command2 
  16.       Caption         =   "TimeTwo "
  17.       Height          =   495
  18.       Left            =   2760
  19.       TabIndex        =   0
  20.       Top             =   2520
  21.       Width           =   1215
  22.    End
  23. End
  24. Attribute VB_Name = "Form1"
  25. Attribute VB_Creatable = False
  26. Attribute VB_Exposed = False
  27. 'Declare the function TimesTwo , which is in the PCE32.DLL.
  28. 'Note PCE32.DLL should be in one of the following
  29. '            1) The current directory
  30. '            2) The Path
  31. '            3) The Windows or Windows\System Directory
  32.  
  33. ' The recommended place is in your Windows\System Directory
  34. '*******************************************************************
  35. '*                                                                 *
  36. '*                      HERE'S A USEFUL TIP                        *
  37. '*                                                                 *
  38. '*******************************************************************
  39.  
  40. ' Win32 (32s/Win95/WinNT) thinks that integers are 32bit
  41. ' Visual Basic 4.0 treats integers as 16bit , this could cause
  42. ' you some problems should you try to call a function in a DLL
  43. ' from VB that takes or returns an integer unless youre aware of
  44. '            (it took some headscratching to figure it out).
  45. '
  46. ' Instead of declaring it as an integer declare it as long.
  47. '
  48. ' You should also use Long for any other Handles etc that you have
  49. ' to pass.
  50. '
  51. ' Another tip is that VB4 is case sensitive when it comes to DLL names
  52. ' EG :- PCE32.DLL is not the same as Pce32.Dll
  53.  
  54.  
  55.  
  56. Private Declare Function TimesTwo Lib "PCE32.DLL" (ByVal X As Integer) As Long
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.  
  71. Private Sub Command2_Click()
  72. ' Call the Fuction TimesTwo
  73. X = TimesTwo(300)
  74. ' and display the result in a MessageBox
  75. msg = "Returned value is " & X
  76. y = MsgBox(msg, 64, "PCE32 Demo")
  77.  
  78. End Sub
  79.  
  80.  
  81. Private Sub Form_Load()
  82. Show
  83. Cls
  84. Print
  85. Print " This is a very basic example of how to call the PCE32.Dll , simply click on the TimesTwo button"
  86. Print " below and the TimesTwo function in the DLL will be called , the result of the call will then be"
  87. Print " displayed in a MessageBox."
  88. Print
  89. Print " Try changing the value of TimesTwo (in this case its 300) to get different results."
  90. Print
  91. Print
  92.  
  93. End Sub
  94.  
  95.  
  96.